package com.pzl.simplevpindicator;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.pzl.library.BeansIndicator;
import com.pzl.library.Indicator;

public class BeansIndicatorDemo extends AppCompatActivity {
    private ViewPager viewPager;
    private Indicator indicator;

    private void initView() {
        viewPager = (ViewPager) findViewById(R.id.vp);
        indicator = (BeansIndicator) findViewById(R.id.beansIndicator);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_beans_indicator_demo);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });

        initView();
        viewPager.setAdapter(new MyViewPagerAdapter(getSupportFragmentManager()));
        indicator.bindViewPager(viewPager);
    }

}
